const mongoose = require('mongoose');
const moment = require('moment');
const departmentSchema = mongoose.Schema({
    parentId: String,
    deptName: String,
    sort: Number,
    personInCharge: String,
    contactNumber: String,
    email: String,
    status: String,
}, {
    collection: 'department', timestamps: true,
    toJSON: {
        virtuals: true,
        transform: (doc, ret) => {
            ret.createdAt = moment(ret.createdAt).format('YYYY-MM-DD HH:mm:ss');
            ret.updatedAt = moment(ret.updatedAt).format('YYYY-MM-DD HH:mm:ss');
            delete ret.__v;
            id = ret._id;
            return ret;
        }
    },
    toObject: { virtuals: true }
});
const Department = module.exports = mongoose.model('department', departmentSchema);